package com.ysstech.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * 系统常量
 *
 * @author lsl
 */
@Getter
@AllArgsConstructor
public enum YssMysqlColumnEnum implements BaseEnum<String> {
    VARCHAR("VARCHAR", ""),
    NUMBER("NUMBER", ""),
    CLOB("CLOB", ""),
    TIMESTAMP("TIMESTAMP", ""),
    DATE("DATE", ""),
    BLOB("BLOB", ""),
    NCLOB("NCLOB", ""),
    NVARCHAR2("NVARCHAR2", ""),
    CHAR("CHAR", ""),
    INTEGER("INTEGER", ""),
    FLOAT("FLOAT", "");

    private final String code;
    private final String desc;

    public static YssMysqlColumnEnum getEnum(String code) {
        return Arrays.stream(values()).filter(b -> Objects.equals(b.code, code)).findFirst().orElse(null);
    }

    public static String getEnumDesc(String code) {
        YssMysqlColumnEnum e = getEnum(code);
        return e != null ? e.desc : null;
    }
}
